{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 222,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## np.array()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 223,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1., 2., 3., 4.])"
      ]
     },
     "execution_count": 223,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.array([1,2,3,4],dtype = 'float64')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## np.arange()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 224,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0. , 0.2, 0.4, 0.6, 0.8])"
      ]
     },
     "execution_count": 224,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.arange(0,1,0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 225,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
      ]
     },
     "execution_count": 225,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.arange(10)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## np.linsapce"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 226,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.  , 0.25, 0.5 , 0.75, 1.  ])"
      ]
     },
     "execution_count": 226,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.linspace(0,1,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 227,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0. , 0.2, 0.4, 0.6, 0.8])"
      ]
     },
     "execution_count": 227,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.linspace(0,1,5,endpoint=False)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## np.zeors()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 228,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 0., 0., 0.])"
      ]
     },
     "execution_count": 228,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.zeros(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 229,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 0., 0.],\n",
       "       [0., 0., 0.],\n",
       "       [0., 0., 0.]])"
      ]
     },
     "execution_count": 229,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.zeros([3,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 230,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 0., 0.],\n",
       "       [0., 0., 0.],\n",
       "       [0., 0., 0.]])"
      ]
     },
     "execution_count": 230,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.zeros((3,3))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## np.diag() np.eye() np.identity()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 231,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 0, 0, 0],\n",
       "       [0, 2, 0, 0],\n",
       "       [0, 0, 3, 0],\n",
       "       [0, 0, 0, 4]])"
      ]
     },
     "execution_count": 231,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.diag([1,2,3,4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 232,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 1, 0, 0, 0],\n",
       "       [0, 0, 2, 0, 0],\n",
       "       [0, 0, 0, 3, 0],\n",
       "       [0, 0, 0, 0, 4],\n",
       "       [0, 0, 0, 0, 0]])"
      ]
     },
     "execution_count": 232,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.diag([1,2,3,4],k=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 233,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 0., 1., 0., 0.],\n",
       "       [0., 0., 0., 1., 0.],\n",
       "       [0., 0., 0., 0., 1.],\n",
       "       [0., 0., 0., 0., 0.],\n",
       "       [0., 0., 0., 0., 0.]])"
      ]
     },
     "execution_count": 233,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.eye(5,k=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 234,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1., 0., 0.],\n",
       "       [0., 1., 0.],\n",
       "       [0., 0., 1.]])"
      ]
     },
     "execution_count": 234,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.identity(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 235,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[0., 0., 0., 0., 0.],\n",
       "        [0., 0., 0., 0., 0.],\n",
       "        [0., 0., 0., 0., 0.]],\n",
       "\n",
       "       [[0., 0., 0., 0., 0.],\n",
       "        [0., 0., 0., 0., 0.],\n",
       "        [0., 0., 0., 0., 0.]]])"
      ]
     },
     "execution_count": 235,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.empty((2,3,5))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ndarray 属性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 236,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3],\n",
       "       [4, 5, 6]])"
      ]
     },
     "execution_count": 236,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a_ndarray = np.array([[1,2,3],[4,5,6]])\n",
    "a_ndarray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "秩为： 2\n",
      "形状为： (2, 3)\n",
      "元素个数为： 6\n"
     ]
    }
   ],
   "source": [
    "print('秩为：',a_ndarray.ndim)\n",
    "print('形状为：',a_ndarray.shape)\n",
    "print('元素个数为：',a_ndarray.size)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 238,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2],\n",
       "       [3, 4],\n",
       "       [5, 6]])"
      ]
     },
     "execution_count": 238,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a_ndarray.reshape(3,2,order='C')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 239,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 5],\n",
       "       [4, 3],\n",
       "       [2, 6]])"
      ]
     },
     "execution_count": 239,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a_ndarray.reshape(3,2,order='F')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 240,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 1 2 3 4 5]\n",
      "int32\n",
      "[0. 1. 2. 3. 4. 5.]\n",
      "float64\n"
     ]
    }
   ],
   "source": [
    "arr1 = np.arange(6)\n",
    "print(arr1)\n",
    "print(arr1.dtype)\n",
    "arr2 = arr1.astype(np.float64)\n",
    "print(arr2)\n",
    "print(arr2.dtype)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 随机数 np.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 241,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[122, 119, 150, 181],\n",
       "       [149, 164, 142, 167]])"
      ]
     },
     "execution_count": 241,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.random.randint(100,200,size = (2,4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 242,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.411837   0.22525006 0.79769591 0.50522859 0.42896535]\n",
      "[[0.64262452 0.48575632]\n",
      " [0.02108669 0.22072524]\n",
      " [0.84469278 0.72762736]\n",
      " [0.73509666 0.51288002]]\n"
     ]
    }
   ],
   "source": [
    "arr1_random = np.random.rand(5)\n",
    "print(arr1_random)\n",
    "arr2_random = np.random.rand(4,2)\n",
    "print(arr2_random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVOUlEQVR4nO3dfayc5Znf8e9vKWHZTdhAObDGLzWNnFUBNWQ5ct1lpbKbdHFotyZSIzmqgqvSOotATaRttSaRuqxWlmiVFxW1QXUShFmlQZaSFCvB3TU0UZQuLzkgwBhCcBY2nNjFTja7If/Qxbn6x9yms8fjM3Pe5pzj5/uRRvPM9dz3zDXjOdfccz/3PE5VIUnqhp9b7gQkSeNj0ZekDrHoS1KHWPQlqUMs+pLUIX9ruRMY5uKLL66NGzcudxqStKo88cQTP6yqiZnxFV/0N27cyNTU1HKnIUmrSpI/HxQfOr2T5OeTPJ7k6SSHk/xBi9+R5AdJnmqXG/r63J7kSJIXklzfF78myaG2764kWYwnJ0kazSgj/deB36yqnyY5F/hWkgNt36er6hP9jZNcAWwHrgQuAx5K8s6qOgnc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KbXGnB6B3qngdjRtncAD8zS9rR5uVa8Tnk/8OyiZjfY0JyT/GKSt53aBn6rL7e5POfFNEreAT4PPF9Vn5qxb1yv9SinC9kP3NRW8WwB/qpNWS3nqUaGPnaSDcCXgQ9V1Xf74rO9X5Y7519u7wuSbKZXt340St/lzLvl+0vAP6Lvvb6Mr3XPchw9XkkX4G8DDwMvtuuLWvwy4MG+dr9A7432SzP6/xFwCHiG3j/6mpWQM71VBU+3y2Hg48P6r5C8f53e1+RngKfa5YZxv9b0Vud8l94KjY+32O8Av9O2Q+8/BPpey2lytr5jfD8Py/tzwI/7XtupYe+XFZDzbS2np+kdfP611fBat9v/Erh/Rr9le62rytMwSFKXOL0jSR1i0ZekDrHoS1KHWPQlqUMs+pLUIRZ9SeoQi74kdcj/A74Xz0tviRsmAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "noise = np.random.normal(loc=0,scale=0.2,size=100000)\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "plt.hist(noise, bins=100)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 1 1 1 0 1 1 1 0]\n"
     ]
    }
   ],
   "source": [
    "test = np.random.binomial(1, 0.5, 10)\n",
    "print(test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5, 1, 4, 2, 6, 3])"
      ]
     },
     "execution_count": 245,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_shuffle_arr = np.array([1,2,3,4,5,6])\n",
    "np.random.shuffle(test_shuffle_arr)\n",
    "test_shuffle_arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 246,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 3 4 5 6]\n",
      "[5 1 2 4 3 6]\n"
     ]
    }
   ],
   "source": [
    "test_permutation_arr = np.array([1,2,3,4,5,6])\n",
    "test_permutation_arr_inner = np.random.permutation(test_permutation_arr)\n",
    "print(test_permutation_arr)\n",
    "print(test_permutation_arr_inner)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 247,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAP2klEQVR4nO3dbYxcV33H8e+POLQQipLIm9TEMaaS+xCiUtAqQCNRSqANEOG8aFCQoBZNZVGlJVRI4FCpUV9EStUqoo9UFqEYEQgWD41FeXINiPIioXaSEhJDE0Ea3Ljx8gylCnX498Ve0+1m1ju7d2Z35uz3I1kz994zO/8zZ/c3Z87MHaeqkCS15UnrXYAkafQMd0lqkOEuSQ0y3CWpQYa7JDVo03oXALB58+bavn37epchSVPlyJEj36iqmUHHJiLct2/fzuHDh9e7DEmaKkn+faljLstIUoMMd0lqkOEuSQ0y3CWpQYa7JDXIcJekBhnuktQgw12SGmS4S1KDJuIMVWnSbN/zjz+5/tBNr1zHSqTVceYuSQ0y3CWpQS7LTAmXCSSthDN3SWrQsuGe5F1JTiT50oJ9f5bky0m+mOQjSc5ecOz6JA8m+UqS3xxT3ZKk0xhm5v5u4PJF+w4CF1fVLwP/BlwPkOQi4Grg2d1t/jbJGSOrVpI0lGXDvao+B3xr0b5PVdXJbvMOYGt3fSdwW1U9VlVfAx4ELhlhvZKkIYziDdXfAT7QXb+A+bA/5Vi37wmS7AZ2A2zbtm0EZWwcvrkqaTm93lBN8kfASeDWU7sGNKtBt62q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MWYJLkCOFFVR07XbMC+iRuTIfsyFePSubSqnsf88su1SV606PhIx2Vqwr1bC/0QcGtVfXhAk6n5yoPl+lJV3zu1TFBVHwPOTLJ5jctckar6DvBZ4PJFh6ZmXGDpfkzRmFwKvCrJQ8x/G+tLkrx3UZtpGZNl+zJF40JVPdJdngA+wvy35y400nGZinBPEuAW4GhV3bxEswPAb3fvOL8A+G5VHV+zIoc0TF+S/GzXjiSXMD9O31y7KoeTZCbJ2d31pwAvBb68qNnEj8sw/ZiWMamq66tqa1VtZ/5rPz5dVa9d1GzixwSG68u0jEuSs7oPUJDkLOA3gC8tajbScZmWT8tcCrwOuLdbFwV4G7ANoKr+DvgY8ArgQeCHwOvXvsyhDNOX3wJ+L8lJ4L+Bq2syTyXeAuzL/H/O8iRgf1V9NMkbYKrGZZh+TMuYDDSFY7KkKR2X84GPdM9Dm4D3VdUnxjkufv2AJDVoKpZlJEkrY7hLUoMMd0lqkOEuSQ0y3CWpQYa7JDXIcJekBv0vWv5QxykZ/ssAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "tes = np.random.uniform(2,5,size=10000)\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "plt.hist(tes, bins=100)\n",
    "plt.show()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数组变换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 248,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3, 4, 5, 6, 7])"
      ]
     },
     "execution_count": 248,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr_reshape = np.arange(8)\n",
    "arr_reshape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 1],\n",
       "       [2, 3],\n",
       "       [4, 5],\n",
       "       [6, 7]])"
      ]
     },
     "execution_count": 249,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr_reshape.reshape(4,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 250,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr_flatten = arr_reshape.reshape(2,-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 251,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3, 4, 5, 6, 7])"
      ]
     },
     "execution_count": 251,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr_flatten.ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 258,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[0 1]\n",
      " [2 3]\n",
      " [4 5]]\n",
      "[[ 0  2]\n",
      " [ 4  6]\n",
      " [ 8 10]]\n",
      "[[ 0  2  0  1]\n",
      " [ 4  6  2  3]\n",
      " [ 8 10  4  5]]\n",
      "[[ 0  2]\n",
      " [ 4  6]\n",
      " [ 8 10]\n",
      " [ 0  1]\n",
      " [ 2  3]\n",
      " [ 4  5]]\n"
     ]
    }
   ],
   "source": [
    "arr_hstack = np.arange(6).reshape(3,2)\n",
    "print(arr_hstack)\n",
    "arr1_hstack = arr_hstack*2\n",
    "\n",
    "print(arr1_hstack)\n",
    "arr3 = np.hstack((arr1_hstack,arr_hstack))\n",
    "arr4 = np.vstack((arr1_hstack,arr_hstack))\n",
    "print(arr3)\n",
    "print(arr4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "横向组合为： [[ 0  1  0  2]\n",
      " [ 2  3  4  6]\n",
      " [ 4  5  8 10]]\n",
      "纵向组合为： [[ 0  1]\n",
      " [ 2  3]\n",
      " [ 4  5]\n",
      " [ 0  2]\n",
      " [ 4  6]\n",
      " [ 8 10]]\n"
     ]
    }
   ],
   "source": [
    "arr1 = np.arange(6).reshape(3,2)\n",
    "arr2 = arr1*2\n",
    "print('横向组合为：',np.concatenate((arr1,arr2),axis = 1))\n",
    "print('纵向组合为：',np.concatenate((arr1,arr2),axis = 0))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 261,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11],\n",
       "       [12, 13, 14, 15]])"
      ]
     },
     "execution_count": 261,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "split_arr = np.arange(16).reshape(4,4)\n",
    "split_arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 265,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "横向分割为:\n",
      " [array([[ 0],\n",
      "       [ 4],\n",
      "       [ 8],\n",
      "       [12]]), array([[ 1],\n",
      "       [ 5],\n",
      "       [ 9],\n",
      "       [13]]), array([[ 2],\n",
      "       [ 6],\n",
      "       [10],\n",
      "       [14]]), array([[ 3],\n",
      "       [ 7],\n",
      "       [11],\n",
      "       [15]])]\n",
      "纵向组合为:\n",
      " [array([[0, 1, 2, 3],\n",
      "       [4, 5, 6, 7]]), array([[ 8,  9, 10, 11],\n",
      "       [12, 13, 14, 15]])]\n"
     ]
    }
   ],
   "source": [
    "print('横向分割为:\\n',np.hsplit(split_arr,4))\n",
    "print('纵向组合为:\\n',np.vsplit(split_arr,2))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 279,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 1, 0],\n",
       "       [0, 1, 2],\n",
       "       [7, 8, 1],\n",
       "       [3, 3, 0],\n",
       "       [2, 2, 7],\n",
       "       [3, 9, 1],\n",
       "       [0, 6, 1],\n",
       "       [3, 8, 6],\n",
       "       [3, 9, 6],\n",
       "       [7, 7, 2]])"
      ]
     },
     "execution_count": 279,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "interest_score = np.random.randint(10, size=(10, 3)) \n",
    "interest_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 280,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "108"
      ]
     },
     "execution_count": 280,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "interest_score.sum(axis=(0,1))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2, 1)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 10,  20,  30],\n",
       "       [ 80, 100, 120]])"
      ]
     },
     "execution_count": 289,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2 = np.array([[10],[20]])\n",
    "print(arr2.shape)\n",
    "arr0 = np.array([[1, 2, 3], [4, 5, 6]])\n",
    "arr0*arr2\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
